package MenuUnit
{
	import flash.display.Bitmap;
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.geom.Point;	
	
	//游戏场景类
	public class Menu extends Sprite
	{
		public var camera:Point;
		public var scrollFactores:Vector.<Point>;
		public var layers:Vector.<Sprite>;
		private var uiElements:Vector.<DisplayObject>;
		
		public function Menu()
		{
			scrollFactores = new Vector.<Point>();
			layers = new Vector.<Sprite>();
			uiElements = new Vector.<DisplayObject>();
		}
		
		public function Add(_obj:DisplayObject,_x:int =0,_y:int=0):void
		{
			if (uiElements == null)
			    uiElements = new Vector.<DisplayObject>();
			uiElements.push(_obj);
			this.addChild(_obj);
			_obj.x = _x;
			_obj.y = _y;
		}
		
		public function Active():void
		{
			
		}
		
		public function Deactivate():void
		{
			for each(var item:DisplayObject in uiElements)
			{
				try
				{
				  removeChild(item);
				}
				catch (e:Error)
				{
					trace(e.message);
				}
			}
		}
		
		private function Clear():void
		{
			for each(var item:DisplayObject in uiElements)
			{
				removeChild(item);
				uiElements.pop();
			}
			uiElements = null;
		}
	}
}